package com.tcfvic.client.panels;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.VerticalSplitPanel;
import com.tcfvic.client.RTODetailsListService;
import com.tcfvic.client.RTODetailsListServiceAsync;
import com.tcfvic.client.panels.widgets.RTODetailsInputWidget;
import com.tcfvic.client.panels.widgets.RTODetailsListWidget;

public class RTODetailsForm {

	/**
	 * Create a remote service proxy to talk to the server-side RTO
	 * service.
	 */
	private final RTODetailsListServiceAsync rtoDetailsListService = GWT
			.create(RTODetailsListService.class);
	private VerticalSplitPanel vSplit = new VerticalSplitPanel();

	public RTODetailsForm(boolean editing) {
		// Create a Vertical Split Panel
		vSplit = new VerticalSplitPanel();
		vSplit.ensureDebugId("cwVerticalSplitPanel");
		vSplit.setSize("900px", "800px");
		vSplit.setSplitPosition("1%");

		RTODetailsInputWidget rtoDetails = new RTODetailsInputWidget();
		RTODetailsListWidget rtoDetailsList = null;
		if (editing) {
			rtoDetailsList = new RTODetailsListWidget(
					rtoDetailsListService, rtoDetails);
			vSplit.setTopWidget(rtoDetailsList);
			vSplit.setSplitPosition("44%");
		}
		rtoDetails.addRTODetailsList(rtoDetailsList);
		vSplit.setBottomWidget(rtoDetails);

	}

	public VerticalSplitPanel getvSplit() {
		return vSplit;
	}
}
